package com.ikas.ai.server.module.condition.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikas.ai.server.module.condition.dao.WorkConditionStepDetailDao;
import com.ikas.ai.server.module.condition.model.WorkConditionStepDetail;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 工况步骤详情Service
 * @Author: qi.yilai
 * @Date: 2023/4/13 10:24
 * @Version: 1.0.0
 **/
@Service
public class WorkConditionStepDetailService extends ServiceImpl<WorkConditionStepDetailDao, WorkConditionStepDetail> {

    /**
     * 根据工况步骤id 列表获取步骤详情列表
     *
     * @param stepIds
     * @return
     */
    public List<WorkConditionStepDetail> getWorkConditionStepDetailByStepIds(List<Long> stepIds) {
        return lambdaQuery().in(WorkConditionStepDetail::getStepId, stepIds).list();
    }

    /**
     * 删除工况的步骤详情
     *
     * @param wfId
     */
    public void removeWOrkConditionStepDetailByWfId(Long wfId) {
        LambdaQueryWrapper<WorkConditionStepDetail> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(WorkConditionStepDetail::getWfId, wfId);
        baseMapper.delete(lambdaQueryWrapper);
    }
}
